import request from '../utils/request'; // 确保路径正确指向你的 request.js 文件

/**
 * 获取验证码服务
 * @param {string} phoneNumber - 用户手机号码
 * @returns {Promise}
 */
export const customerGetCodeService = async (phoneNumber) => {
    let res = await request({
        url: '/customers/getCode', // 注意这里不需要包含基础URL
        method: 'GET',
        data: {
            'phoneNumber': phoneNumber
        }
    });
    return res;
};

/**
 * 客户登录服务
 * @param {Object} customerParam - 包含客户登录信息的对象
 * @returns {Promise}
 */
export const customerLoginService = async (customerParam) => {
    let res = await request({
        url: '/customers/login',
        method: 'POST',
        header: {
            'content-type': 'application/json' // 设置请求头为JSON格式
        },
        data: {
            ...customerParam
        }
    });
    return res;
};

/**
 * 测试服务（GET请求）
 * @returns {Promise}
 */
export const customerTestMp = async () => {
    let res = await request({
        url: '/customers/testMp',
        method: 'GET'
    });
    return res;
};